package equipmentBusiness;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import models.HttpResponse;
import tools.Http;
import tools.JsonPath;

/**
 * Created by yangxianming on 2018/3/9.
 */
public class PmpGetToken {
    public String getToken(){
        String url = "http://903.pmp.front.17shihui.com/p/passport/api/user/login";
        String param = "user_name=yangxm-admin&password=11111111";

        Http http = new Http();
        HttpResponse httpResponse = http.sendRequest("post", null, url, param);
        JSONObject jsonObject = JSON.parseObject(httpResponse.getResponseResult());
        JsonPath jsonPath = new JsonPath();
        return jsonPath.parse(jsonObject, "result/token").getString(0);
    }
}
